package com.bt.util;

import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import org.apache.commons.lang3.StringUtils;

import java.io.IOException;

/**
 * @author wbt
 * @version v1.0
 * @project shop_manage
 * @data 2022/9/26 11:41
 **/
public class goodsValueDeserializer extends JsonDeserializer {
    @Override
    public Object deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException {
        String goodsValue = jsonParser.getText().replace("[", "").replace("]", "");
        if (goodsValue.trim().isEmpty()) {
            return null;
        }else return goodsValue;

    }

}
